import request from '@/utils/request'

// 查询书籍信息列表
export function listBookinfo(query) {
  return request({
    url: '/system/bookinfo/list',
    method: 'get',
    params: query
  })
}

// 查询书籍信息详细
export function getBookinfo(id) {
  return request({
    url: '/system/bookinfo/' + id,
    method: 'get'
  })
}

// 新增书籍信息
export function addBookinfo(data) {
  return request({
    url: '/system/bookinfo',
    method: 'post',
    data: data
  })
}

// 修改书籍信息
export function updateBookinfo(data) {
  return request({
    url: '/system/bookinfo',
    method: 'put',
    data: data
  })
}

// 删除书籍信息
export function delBookinfo(id) {
  return request({
    url: '/system/bookinfo/' + id,
    method: 'delete'
  })
}

//乐曲信息
export function getMusics(id) {
  return request({
    url: '/system/bookinfo/musics/' + id,
    method: 'get'
  })
}

export function addMusic(ids, bookId) {
  var data = {
    ids: ids,
    bookId: bookId
  }
  return request({
    url: '/system/bookinfo/addMusic',
    method: 'post',
    data: data
  })
}

export function removeMusic(id) {
  return request({
    url: '/system/bookinfo/removeMusic/'+ id,
    method: 'delete'
  })
}
